<?php
# $Id: DefaultIndexAction.class.php,v 1.2 2006/06/22 14:41:15 diegor Exp $
require_once(APP_LIB_DIR . 'LoginModel.class.php');
Class DefaultIndexAction Extends Action
{
    function getDefaultView(&$controller, &$request, &$user)
    { 
        return VIEW_INPUT;
    }

    function getRequestMethods()
    {
        return REQ_POST | REQ_GET;
    }

    function IsSecure()
    {
        return true;
    }

    function getparameters($request)
    {
        $param = array();
        $param['flag'] = $request->getParameter('flag');
        $param['mod'] = $request->getParameter('mod');

        return $param;
    }

    function execute(&$controller, &$request, &$user)
    {
      /*  # Initialize model
        $tm = new TicketModel('DefaulIndexAction');
        $bm = new BulletinModel('DefaultIndexAction');*/
        $lm = new LoginModel('DefaultIndexAction');

        # Get template parameters
        $param = $this->getparameters($request);

        # Generate template parameters
     //   $request->setAttribute('stats', $tm->ticket_stats());
    //    $request->setAttribute('posts', $bm->get_announcements());
        $request->setAttribute('logged', $lm->get_online_auths());

        switch($param['flag']){
            case "new":
                $request->setParameter('mod', 'DefaultIndex');
               $controller->forward(DEFAULT_MODULE, 'Registration');
                return VIEW_NONE;
            break;

            case "view":
                  echo "View";
          //      $request->setParameter('mod', 'DefaultIndex');
           //     $controller->forward(DEFAULT_MODULE, 'TicketList');
                return VIEW_NONE;
            break;
            
            case "enroll":
                  $request->setParameter('mod', 'DefaultIndex');
                  $controller->forward(DEFAULT_MODULE, 'Enrollment');
                return VIEW_NONE;
            break;
        }

        return VIEW_INPUT;
    }
}
?>
